# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=antimicrox
pkgver=3.4.0
pkgrel=0
pkgdesc="Map keyboard buttons and mouse controls to a gamepad."
url="https://github.com/AntiMicroX/antimicrox"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	extra-cmake-modules
	itstool
	qt5-qttools-dev
	qt5-qtbase-dev
	samurai
	sdl2-dev
	"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/AntiMicroX/antimicrox/archive/refs/tags/$pkgver.tar.gz
	no-execinfo.patch
	time64.patch
	"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
be2c811998508590c3dce17dd1a0d3a51bcaa6c629a4a74ac22a82f995eed3ce5ce4583667e47418b8b7c934b2f9bf6ad3d5f6d9eec5216e7f5c731aa82bcc69  antimicrox-3.4.0.tar.gz
01dc61d7556f6a89a3b32a9165bb4c4d2a65e0a7b3142c4ef97ef48015b8f30c767bb863256f0229d1057d1b3144e6219009ceea68921af665b0cf58cb11bf62  no-execinfo.patch
2c136b6e7cf5c6fff5f3d1e411ee0b8547d790912e16ee576bd87be0548fd058bbc5ebff4cfc7b01ee14336ef7afaed495079bf2a1bb009c2fbd90aa09b6a25c  time64.patch
"
